//
//  MTHomeReweetView.swift
//  MTWeiBo
//
//  Created by user on 2017/7/27.
//  Copyright © 2017年 itcast. All rights reserved.
//

import UIKit

//转发微博视图
class MTHomeReweetView: UIView {
    
    
    //  引用ViewModel
    var statusViewModel: MTSatusViewModel? {
        didSet{
            //控件赋值
            contentLabel.text = statusViewModel?.retweetContent
           // print(contentLabel.text)
        }
    }
    
    ///懒加载控件
    private lazy var contentLabel: UILabel = {
        let label = UILabel(fontSize: 13, textColor: UIColor.lightGray)
        label.numberOfLines = 0
        return label
    }()
    
    
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    //搭建界面
    private func setupUI() {
        backgroundColor = UIColor(white: 0.95, alpha: 1)
        //添加
        addSubview(contentLabel)
        //约束
        contentLabel.snp.makeConstraints { (make) in
            make.top.leading.equalTo(self).offset(HomeCellMargin)
            make.trailing.equalTo(self).offset(-HomeCellMargin)
        }
        //关键约束
        self.snp.makeConstraints { (make) in
            make.bottom.equalTo(contentLabel).offset(HomeCellMargin)
        }
    }
}
